﻿ @model MVCWebUIComponent.Models.ProgressbarModel
 
 <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
 <style>
.ui-progressbar {
position: relative;
}
.progress-label {
position: absolute;
left: 50%;
top: 4px;
font-weight: bold;
text-shadow: 1px 1px 0 #fff;
}
</style>

<script>
//    $(function () {
//        $("#progressbar").progressbar({
//            value: false
//        });
//        $("button").on("click", function (event) {
//            var target = $(event.target),
//progressbar = $("#progressbar"),
//progressbarValue = progressbar.find(".ui-progressbar-value");
//            if (target.is("#numButton")) {
//                progressbar.progressbar("option", {
//                    value: Math.floor(Math.random() * 100)
//                });
//            } else if (target.is("#colorButton")) {
//                progressbarValue.css({
//                    "background": '#' + Math.floor(Math.random() * 16777215).toString(16)
//                });
//            } else if (target.is("#falseButton")) {
//                progressbar.progressbar("option", "value", false);
//            }
//        });
//    });
    $(function () {
        var progressbar = $(".progressbar"),
progressLabel = $(".progress-label");
        progressbar.progressbar({
            value: false,
            change: function () {
                progressLabel.text(progressbar.progressbar("value") + "%");
            },
            complete: function () {
                progressLabel.text("Complete!");
            }
        });
        function progress() {
            var val = progressbar.progressbar("value") || 0;
            progressbar.progressbar("value", val + 1);
            if (val < 99) {
                setTimeout(progress, @Model.IncrementTimeInterval);
            }
        }
        setTimeout(progress, @Model.LoadingTimeInterval);
    });
</script>
@*<style>
#progressbar .ui-progressbar-value {
background-color: #ccc;
}
</style>

<div id="progressbar"  style="width:50%"></div>*@
<div class="progressbar"><div class="progress-label">Loading...</div></div>
@*<button id="numButton">Random Value - Determinate</button>
<button id="falseButton">Indeterminate</button>
<button id="colorButton">Random Color</button>*@